<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title></title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="../static/shopPrivate/layui/css/layui.css" media="all">
	<link rel="stylesheet" href="../static/shopPrivate/shopManage/css/rightCon.css" media="all">
	<link rel="stylesheet" href="../static/shopPrivate/shopManage/css/page.css" media="all">
	<link rel="stylesheet" href="../static/shopPrivate/shopManage/css/tree.css" media="all">
	<link rel="stylesheet" href="../static/shopPrivate/css/thesame.css" media="all">
	<link rel="stylesheet" href="../static/shopPrivate/css/footer.css" media="all">
</head>

<body class="layui-layout-body">
	<div class="layui-body layui-body-pb60px">
		<div class="scroll-box">
			<div class="scroll-box-con">
				<div class="crumbs-nav f14px pb16px">
					<span>商铺</span>
					<span class="current">新建商铺</span>
				</div>
				<div class="border-radius4 bgWhite pad16px">
					<div class="f18px pb16px border-bot1px">编辑商铺</div>
					<article>
						<div class="title-border fb mt16px mb16px">基本信息</div>
						<div class="display-flex">
							<div class="add-mess form-style pb16px border-bot1px">
								<div class="add-mess-child">
									<div>
										<label><em class="red">*</em>商铺名称：</label>
									</div>
									<p class="four"><input id="shopName" type="text" placeholder="请输入商铺名称"></p>
								</div>
								<div class="add-mess-child">
									<div>
										<label><em class="red">*</em>经营业态：</label> 
									</div>
									<p class="two">
										<select name="" id="businessType" class="form-select-img">
											<option value="">请选择</option>
					                        <option th:each="list:${businessTypeList}" th:value="${list.id}"  th:text="${list.labelName}"></option>
										</select>
									</p>
								</div>
								<div class="add-mess-child">
									<div>
										<label><em class="red">*</em>所在地区：</label> 
									</div>
									<p class="add-mess-form-tree three">
										<input type="text" placeholder="请输入" id="orgId" class="form-select-img">
									</p>
									<div class="tree-con-box" id="organizationDiv" style="left:85px">
										<!--组织架构-->
									</div>
								</div>
								<div class="add-mess-child">
									<div>
										<label><em class="red">*</em>门牌地址：</label>
									</div>
									<p class="four"><input type="text" id="address" placeholder="请输入"></p>
								</div>
								<div class="add-mess-child layui-form">
									<div> 
										<label><em class="red">*</em>经营状态：</label>
									</div>
									<p>
										<span th:each="list:${managementStatusList}">
											<input type="radio" name="managementStatus"  th:value="${list.id}"  lay-skin="primary" th:title="${list.labelName}">
										</span>
										<!-- <span><input type="radio" name="1" lay-skin="primary" title="经营"></span>
										<span><input type="radio" name="1" lay-skin="primary" title="装修"></span>
										<span><input type="radio" name="1" lay-skin="primary" title="歇业"></span> -->
									</p>
								</div>
							</div>
							<div class="add-mess form-style pb16px border-bot1px" style="flex:1; margin-left: 50px;">
								<div class="add-mess-child">
									<div>
										<label>商铺照片：</label>
									</div>
									<ul class="add-mess-filejs overflow">
										<li>
											<span>
												<img id="shopImgUrl" src="../static/shopPrivate/shopManage/img/file_02.png" class="filejs_shop_img" style="width: 120px; height: 120px;">
											</span>
											<input type="file" id="file_input" class="hidden file_shop_img"/>
										</li>
									</ul>
								</div>
							</div>
						</div>
					</article>
					<article>
						<div class="title-border fb mt16px mb16px">商铺信息</div>
						<div class="layui-tab layui-tab-parent">
							<ul class="layui-tab-title">
								<li class="layui-this">商铺详情</li>
								<li>商铺产权</li>
								<!-- <li>证照管理</li> -->
							</ul>
							<div class="layui-tab-content border1px border-top0" style="padding: 20px;">
								<div class="layui-tab-item  layui-show">
									<div class="add-mess form-style">
										<div class="add-mess-child">
											<div>
												<label><em class="red">*</em>姓名：</label>
											</div>
											<p class="two"><input id="shopkeeperName" type="text" placeholder="请输入"></p>
										</div>
										<div class="add-mess-child">
											<div>
												<label>身份证号：</label>
											</div>
											<p class="two"><input id="userPid" type="text" placeholder="请输入"></p>
										</div>
										<div class="add-mess-child">
											<div>
												<label><em class="red">*</em>手机号：</label>
											</div>
											<p class="two"><input id="phone" type="text" placeholder="请输入"></p>
										</div>
										<div class="add-mess-child">
											<div>	
												<label>开业日期：</label>
											</div>
											<p class="two"><input type="text" id="openTime" placeholder="请输入" class="time"></p>
										</div>
										<div class="add-mess-child">
											<div>
												<label>从业人数：</label>
											</div>
											<p class="one">
												<input id="employedNumber" type="text" placeholder="请输入" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'0')}else{this.value=this.value.replace(/\D/g,'')}"   >
											</p>
										</div>
										<div class="add-mess-child">
											<div>
												<label>商铺面积：</label>
											</div>
											<p class="one relative area"><input id="shopArea"  onkeyup="clearNoNum(this)"  type="text" placeholder="请输入"></p>
										</div>
										<div class="add-mess-child">
											<div>
												<label>店铺标签：</label>
											</div>
											<p class="form-content six">
												<span th:each="list:${shopTypeList}" th:value="${list.id}"  th:text="${list.labelName}"></span>

												<!-- <span class="current">管理员</span>
												<span>街道领导</span>
												<span>巡防人员</span>
												<span>居委会</span> -->
											</p>
										</div>
										<div class="add-mess-child">
											<div>
												<label>备注：</label> 
											</div>
											<p class="five"><textarea name="" id="remarks" cols="5" rows="3"></textarea></p>
										</div>
									</div>
								</div>
								<div class="layui-tab-item">
									<div class="add-mess form-style">
										<div class="add-mess-child">
											<div>
												<label>商铺产权：</label>
											</div>
											<p class="two">
												<select id="shopProperty" name="" class="form-select-img">
													<option value="">请选择</option>
													<option value="1">个人</option>
													<option value="2">企业</option>
												</select>
											</p>
										</div>
										<div class="add-mess-child"> 
											<div>
												<label>产权人：</label>
											</div>
											<p class="two"><input id="propertyName" type="text" placeholder="请输入"></p>
										</div>
										<div class="add-mess-child">
											<div>
												<label>身份证号：</label>
											</div>
											<p class="two"><input id="propertyUserPid" type="text" placeholder="请输入"></p>
										</div>
										<div class="add-mess-child">
											<div>	
												<label>联系方式：</label>
											</div>
											<p class="two"><input id="propertyPhone" type="text" placeholder="请输入"></p>
										</div>
									</div>
								</div>
								<!-- <div class="layui-tab-item">
									<div class="border1px pad16px" style="width: 660px;">
										<div class="title-border fb mb16px overflow">
											<p class="left">证照信息</p>
											<p class="right"><img src="../static/shopPrivate/shopManage/img/icon_delete_zz.png" ></p>
										</div>
										<div class="add-mess form-style">
											<div class="add-mess-child">
												<div>
													<label>证照名称：</label>
												</div>
												<p class="two">

													<select name="" class="form-select-img">
														<option value="">请选择</option>
														<option th:each="list:${licenceTypeList}" th:value="${list.id}"  th:text="${list.labelName}"></option>
													</select>
												</p>
											</div>
											<div class="add-mess-child layui-form">
												<div>
													<label>证照有效期：</label>
												</div>
												<p>
													<span><input type="radio" name="validityType" value="1" lay-skin="primary" title="有效期限"></span>
													<span><input type="radio" name="validityType" value="2" lay-skin="primary" title="永久（无期限）"></span>
												</p>
											</div>
											<div class="add-mess-child">
												<div>	
													<label>有效期至：</label>
												</div>
												<p class="two"><input id="validityTime" type="text" placeholder="请输入" class="time1"></p>
											</div>
											<div class="add-mess-child">
												<div>
													<label>上传照片：</label>
												</div>
												<ul class="add-mess-filejs overflow">
													<li>
														<span><img src="../static/shopPrivate/shopManage/img/img_file.png"></span>
														<em><img src="../static/shopPrivate/shopManage/img/icon_delete_file.png" alt=""></em>
													</li>
													<li>
														<span><img src="../static/shopPrivate/shopManage/img/img_file.png" class="filejs"></span>
														<input type="file" class="hidden file"/>
													</li>
												</ul>
											</div>
										</div>
									</div>
									<div class="new-data-btn mt16px mb16px lh30px overflow">
										<p class="left" onclick="addLicenseInformation()">
											<span class="white border-radius4 bgBlue inline-block cursor">
												<img src="../static/shopPrivate/shopManage/img/button_add.png">添加
											</span>
										</p>
									</div>
								</div> -->
							</div>
						</div>
					</article>
				</div>
			</div>
		</div>
	</div>
	<div class="layui-footer layui-footer-one">
		<div class="btn-con textCenter lh40px">
			<span class="btn-compile" onclick="saveShop()">提&nbsp;交</span>
			<span class="btn-cancel"  onclick="cancel()">取&nbsp;消</span>
		</div>
	</div>


<script src="../static/shopPrivate/js/jquery-3.1.1.min.js"></script>
<script src="../static/shopPrivate/layui/layui.js" charset="utf-8"></script>
<!-- <script src="../static/shopPrivate/shopManage/js/treeFour.js"></script> -->
<script src="../static/shopPrivate/shopManage/js/treeTwo.js"></script>
<script src="../static/shopPrivate/js/selectColor.js"></script>
<script>

	$(function(){

		$('.add-mess-child .six span').click(function(){
			// $(this).addClass('current').siblings().removeClass('current');
			$(this).toggleClass('current');
		})

		layui.use(['form','element','laydate'], function() {
			var form = layui.form;
			var element = layui.element;
			var laydate = layui.laydate;
			laydate.render({
			    elem: '.time',
				type: 'date'
			});
			laydate.render({
			    elem: '.time1',
				type: 'date'
			});
		});

		// $(".filejs").click(function(){
		// 	$(".file").click();
		// })

		// init();


		$(".filejs_shop_img").click(function(){
			$(".file_shop_img").click();
		})



		//上传图片
		document.getElementById("file_input").addEventListener('change', readFile, false);


		//获取组织架构
		getOrganization();






	})



	//取消
	function cancel(){
		window.location.href="../shop/jumpShopListPage";
	}


	//保存
	function saveShop(){

		//--------------基本信息---------------
		var shopName = $("#shopName").val();
		var businessType = $("#businessType").val();
		var orgId = orgIdValue;
		var address = $("#address").val();
		var managementStatus =$("input:radio[name='managementStatus']:checked").val();
		var shopImgUrl = $("#shopImgUrl").attr("value");;


		// console.log("managementStatus="+managementStatus);

		//--------------商铺详情---------------
		var shopkeeperName = $("#shopkeeperName").val();
		var userPid = $("#userPid").val();
		var phone = $("#phone").val();

		var openTime = $("#openTime").val();
		var employedNumber = $("#employedNumber").val();
		var shopArea = $("#shopArea").val();
		var remarks = $("#remarks").val();
		var shopType ="";
		if ($(".six span.current").length>0) {
			for (let i = 0; i < $(".six span.current").length; i++) {
				// console.log($(".six span.current").eq(i).attr("value"));
				shopType+=$(".six span.current").eq(i).attr("value")+",";
			}
		}
		if (!isNull(shopType)) {
			shopType = shopType.substr(0,shopType.length-1);
		}

		//--------------商铺产权---------------
		var shopProperty = $("#shopProperty").val();
		var propertyName = $("#propertyName").val();
		var propertyUserPid = $("#propertyUserPid").val();
		var propertyPhone = $("#propertyPhone").val();




		if (isNull(shopName)) {
			layer.msg('商铺名称不能为空', {time: 2000});
			return;
		}else{
			if (shopName.length>20) {
				layer.msg('商铺名称输入过长', {time: 2000});
				return;
			}
		}

		if (isNull(businessType)) {
			layer.msg('经营业态不能为空', {time: 2000});
			return;
		}

		if (isNull(orgId)) {
			layer.msg('所在地区不能为空', {time: 2000});
			return;
		}


		if (isNull(address)) {
			layer.msg('门牌地址不能为空', {time: 2000});
			return;
		}else{
			if (address.length>50) {
				layer.msg('门牌地址输入过长', {time: 2000});
				return;
			}
		}

		if (isNull(managementStatus)) {
			layer.msg('经营状态不能为空', {time: 2000});
			return;
		}

 
		if (isNull(shopkeeperName)) {
			layer.msg('姓名不能为空', {time: 2000});
			return;
		}else{
			if (shopkeeperName.length>10) {
				layer.msg('姓名输入过长', {time: 2000});
				return;
			}
		}

		if (!isNull(userPid)) {
			if (!checkUserPid(userPid)) {
				layer.msg('请输入正确的身份证', {time: 2000});
				return;
			}
		}

		if (isNull(phone)) {
			layer.msg('请输入手机号', {time: 2000});
			return;
		}else{
			if (!isPhoneNumber(phone)) {
				layer.msg('手机号输入错误', {time: 2000});
				return;
			}
		}

		if (!isNull(remarks)) {
			if (remarks.length>200) {
				layer.msg('备注输入过长', {time: 2000});
				return;
			}
		}


		if (!isNull(propertyName)) {
			if (propertyName.length>50) {
				layer.msg('产权人输入过长', {time: 2000});
				return;
			}
		}


		if (!isNull(propertyUserPid)) {
			if (!checkUserPid(propertyUserPid)) {
				layer.msg('请输入正确的商铺产权身份证', {time: 2000});
				return;
			}
		}


		if (!isNull(propertyPhone)) {
			if (propertyPhone.length>50) {
				layer.msg('联系方式输入过长', {time: 2000});
				return;
			}
		}


		var formDate =
			{
				shopName: shopName,
				businessType: businessType,
				orgId: orgId,
				address: address,
				managementStatus: managementStatus,
				shopImgUrl:shopImgUrl,
				shopkeeperName: shopkeeperName,
				userPid: userPid,
				phone: phone,
				openTime: openTime,
				employedNumber: employedNumber,
				shopArea: shopArea,
				remarks: remarks,
				shopType: shopType,
				shopProperty: shopProperty,
				propertyName: propertyName,
				propertyUserPid: propertyUserPid,
				propertyPhone: propertyPhone
			};

		$.ajax({
            url: "../shop/addShop",
            type: "post",
            dataType: "json",
            data: formDate,
            async: false,
            success: function (res) {
				// console.log(res);
                if (res.code == "200") {
					layer.msg('保存成功', {icon: 1,time:1500},function(){
						window.location.href="../shop/jumpShopRegister";
					});
                }else{
                	layer.msg(res.msg, {icon: 2,time:3000});
                }
            }
        });
	}


	function readFile() {
		var input = document.getElementById("file_input");
		var dataArr = []; // 储存所选图片的结果(文件名和base64数据)

        var fd = new FormData();
        var iLen = this.files.length;
        var index = 0;
        for (var i = 0; i < iLen; i++) {
            if (!input['value'].match(/.jpg|.gif|.png|.jpeg|.bmp/i)) {　　//判断上传文件格式
            	layer.msg('上传的图片格式不正确，请重新选择', {time: 3000});
     //        	layer.open({
			 	// 	content: '上传的图片格式不正确，请重新选择'
			 	// 	,skin: 'msg'
			 	// 	,time: 2 //2秒后自动关闭
			 	// });
                return ;
            }
            var reader = new FileReader();
            reader.index = i;
            //fd.append(i,this.files[i]);
            fd.append("file", this.files[i]);
            sendImage(fd);//传送图片
            reader.readAsDataURL(this.files[i]);  //转成base64
            reader.fileName = this.files[i].name;
			//var imageName2= 
			
			//console.log("====="+imageName2);
            reader.onload = function (e) {
                var imgMsg = {
                    name: this.fileName,//获取文件名
                    base64: this.result   //reader.readAsDataURL方法执行完后，base64数据储存在reader.result里
                }
                dataArr.push(imgMsg);
                $('#shopImgUrl').attr('src', imgMsg.base64); //图片链接（base64）
            }

            
        }
    }

    function sendImage(fd) {
        $.ajax({
            url: '../img/pic/uploadImage',
            type: 'post',
            data: fd,//JSON.stringify(submitArr),
            dataType: 'json',
            cache: false,
            processData: false,   //用FormData传fd时需有这两项     必要
            contentType: false,    //必要
            async: true,
            beforeSend:function(){
            	layer.load(2);
            },
            success: function (res) {
            	layer.closeAll();
                if (res.code == "0000") {
                	$('#shopImgUrl').attr('value', res.msg); //图片链接（base64）
                	
                }else{
                	return layer.msg("图片上传失败，请重试", {time: 2000});
                }
            }
        });
    }
	


    //获取组织架构
	function getOrganization(){

		var formDate =
            {	
            };

        $.ajax({
            url: "../organization/getOrgList",
            type: "get",
            dataType: "json",
            data: formDate,
            async: false,
            success: function (res) {
				 // console.log(res);
                if (res.code == "200") {
					var organizationList = res.data;
					
					var organizationDivStr = getOrganizationDivStr(organizationList,1);

					$("#organizationDiv").html(organizationDivStr);
					// $("#registerAreaOfResidenceDiv").html(organizationDivStr);

					//初始化
					init();


                }else{
                	layer.msg(res.msg, {icon: 2,time:3000});
                }
            }
        });
	}


	function getOrganizationDivStr(organizationList,registerOrLive){

		var str="";
		var whichFloor = 1;
		var uLHasNum = switchCss(whichFloor);
		str+="<ul class="+uLHasNum+">";
		$.each(organizationList,function(key,rog1){
    		
			str+='<li>';
			str+='<div class="tree-children" >';
			str+='<div>';

			str+="<p class='tree-arrow cursor'><img src='../static/shopPrivate/shopManage/img/icon_select_up.png'></p>"
			str+='<p data-orgid="'+rog1.id+'" data-orgname="'+rog1.name+'" onclick="organizationChangeQuery(this)">'+rog1.name+'</p>';
			str+='</div>';
			str+='</div>';
			
			if( !isNull(rog1.sysOrganizations) && rog1.sysOrganizations.length>0){
				str+=splicingMainStr(rog1,whichFloor);
			}
			str+='</li>';
		});
		str+='</ul>';


		return str;
	}


	//拼接	
	function splicingMainStr(rog1,whichFloor){
		var str = "";
		if(!isNull(rog1.sysOrganizations) && rog1.sysOrganizations.length>0){
			whichFloor = whichFloor+1;
			var uLHasNum = switchCss(whichFloor);

			str+='<ul class=" '+uLHasNum+'">';

			$.each(rog1.sysOrganizations,function(key,rog2){
				if( !isNull(rog2.sysOrganizations) && rog2.sysOrganizations.length>0){
					str+='<li>';
					str+='<div class="tree-children">';
					str+='<div  >';
					str+="<p class='tree-arrow cursor'><img src='../static/shopPrivate/shopManage/img/icon_select_up.png'></p>"
					str+='<p  data-orgid="'+rog2.id+'" data-orgname="'+rog2.name+'"  onclick="organizationChangeQuery(this)" >'+rog2.name+'</p>';
					str+='</div>';
					str+='</div>';
					str+=splicingMainStr(rog2,whichFloor);
					str+='</li>';
				}else{
					if(!isNull(rog2)){
						str+=splicingStr(rog2);
					}
				}
			})
			str+='</ul>';

		}else{
			if(!isNull(rog1)){
				str+=splicingStr(rog1);
			}
		}
		return str;
	}



	//拼接
	function splicingStr(org){
		var str ="";
		//是否是行政机构 0-否，1-是    type 是否实际勾选 1-是 0-否
		str+='<li>';
		str+='<div  class="tree-children">';
		str+='<div>';
		str+='<p  data-orgid="'+org.id+'" data-orgname="'+org.name+'"  onclick="organizationChangeQuery(this)" >'+org.name+'</p>';
		str+='</div>';
		str+='</div>';
		str+='</li>';
		return str;
	}


	//层级转换标签
	function switchCss(whichFloor){

		var uLHasNum = "";

		switch (whichFloor) {
		  case 1:
		    uLHasNum = "tree-one";
		    break;
		  case 2:
		    uLHasNum = "tree-two";
		    break;
		  case 3:
		    uLHasNum = "tree-three";
		    break;
		  case 4:
		    uLHasNum = "tree-four";
		    break;
		  case 5:
		    uLHasNum = "tree-five";
		}
		return uLHasNum;
	}





	var orgIdValue ="";//所在地区
	function organizationChangeQuery (obj){
		var orgId = $(obj).data("orgid");
		var orgName = $(obj).data("orgname");
		orgIdValue = orgId;

		$("#orgId").val(orgName);
		$('.add-mess-child .tree-con-box').hide();
		// console.log("orgId="+orgId+"-----"+"orgName="+orgName+"-----"+"orgIdValue="+orgIdValue);

	}




    //检查身份证号码是否符合规范，包括长度，类型
	function checkUserPid(card)
	{
	    //身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X
	    var reg = /(^\d{15}$)|(^\d{17}(\d|X|x)$)/;
	    if(reg.test(card) === false)
	    {
	        return false;
	    }
	    return true;
	};

	/**判断是否是手机号**/
	function isPhoneNumber(tel) {
	    var reg =/^0?1[3|4|5|6|7|8][0-9]\d{8}$/;
	    return reg.test(tel);
	}

    //验证小数点后两位
    function checkSalary(num){
		var reg = /^([0]|([1-9][0-9]*)|(([0]\.\d{1,}|[1-9][0-9]*\.\d{1,})))$/;
		if (!reg.test(num)) {
		    return false;
		}
		reg = /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
		if (!reg.test(num)) {
		    return false;
		}
		return true;
	}

    //小数点后两位  onkeyup="clearNoNum(this)" 
	function clearNoNum(obj) {
        obj.value = obj.value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符  
		obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的  
		obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$","."); 
		obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');//只能输入两个小数  
		//如果没有小数点，不能为类似 01、02的金额 
		if(obj.value.indexOf(".")< 0 && obj.value !=""){
		    obj.value= parseFloat(obj.value); 
		}
		//如果有小数点，不能为类似 1.10的金额  
		if(obj.value.indexOf(".")> 0  && obj.value.indexOf("0")>2){
		    obj.value= parseFloat(obj.value); 
		}
		 //如果有小数点，不能为类似 0.00的金额 
		if(obj.value.indexOf(".")> 0  && obj.value.lastIndexOf("0")>2){
		    obj.value= parseFloat(obj.value); 
		} 
    }


    function clearUpNum(obj) {
        obj.value = obj.value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符  
		// obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的  
		// obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$","."); 
		obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');//只能输入两个小数  
		//如果没有小数点，不能为类似 01、02的金额 
		if(obj.value.indexOf(".")< 0 && obj.value !=""){
		    obj.value= parseFloat(obj.value); 
		}
		//如果有小数点，不能为类似 1.10的金额  
		if(obj.value.indexOf(".")> 0  && obj.value.indexOf("0")>2){
		    obj.value= parseFloat(obj.value); 
		}
		 //如果有小数点，不能为类似 0.00的金额 
		if(obj.value.indexOf(".")> 0  && obj.value.lastIndexOf("0")>2){
		    obj.value= parseFloat(obj.value); 
		} 
    }



    function isNull(value) {
		return value == null || value === "" || value === undefined;
	}

</script>
</body>

</html>
